<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修饰符</title>
    <style>
        .child {
            width: 50px;
            height: 50px;
            background-color: blue;
        }

        .father {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <!-- 
        v-model
            .trim：去除收尾空格
            .number: 自动转为数字如果输入的事字符或者字母 不会转还是字符串
        事件修饰符
            @事件名.stop      -> 阻止冒泡
            @事件名.prevent   -> 阻止默认行为

     -->
    <div id="app">
        <h3>v-model修饰符 .trim .number</h3>
        账号: <input type="text" v-model.trim="username"><br>
        密码：<input type="text" v-model.number="password">
        <hr>
        <div @click="father()" class="father">
            <div @click.stop="child()" class="child"></div>
        </div>
        <a @click.prevent href="http://baidu.com">跳转百度</a>
    </div>

    <script src="./script/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                username: '',
                password: ''
            },
            methods: {
                father() {
                    alert('我是父亲')
                },
                child() {
                    // 原生js阻止冒泡
                    // e.stopPropagation()
                    alert('我是儿子')
                }
            },
        })
    </script>
</body>

</html>